package com.vsoft.sms_cm;

import java.io.DataOutputStream;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;

import org.apache.log4j.Logger;

import com.vsoft.framework.core.BaseException;
import com.vsoft.framework.core.BusiObj;
import com.vsoft.framework.core.Configuration;
import com.vsoft.framework.core.db.DBGadgets;
import com.vsoft.framework.core.db.DBTrans;
import com.vsoft.framework.core.esb.ServiceBus;
import com.vsoft.framework.core.util.BOHelper;
import com.vsoft.framework.core.util.LogCollect;
import com.vsoft.framework.core.util.XMLUtil;
import com.vsoft.framework.server.servlet.SessionData;
import com.vsoft.framework.server.servlet.HttpUtil;
import com.vsoft.anti_fra.*;

public class TestStatic {

	private static Logger vLogger = Logger.getLogger(TestQuery.class);
	private static String vName = TestStatic.class.getName();
	private SessionData vSD = null;
	private String vDebugHome = "";
	private BusiObj				vInBO		=  new BusiObj();
	
	
	public static void main(String[] args)  {
	
		try{

			vLogger.info("---------------InitSystem-------------");
			Configuration.InitSystem();
			vLogger.info("---------------generate test data-------------");
			
			String orig = "This is a original string.";
			String replacement = "\\Replaced";
			System.out.println(replacement);
			String replacedString = orig.replaceAll("original", replacement);
			System.out.println(replacedString);
			
			String match="&SESSION_AREA_CODE=\\d*&";
			//match ="SESSION_AREA_CODE";
			String url="/birt_Viewer/frameset?__report=rpt_subsCount.rptdesign&ent_code=0&SESSION_AREA_CODE=990&SESSION_ENT_CODE";
			vLogger.info("--------------url-------------"+url);
			vLogger.info("--------------match-------------"+match);
			String newUrl=	    url.replaceAll(match, "&");
			match="/birt_Viewer";
			newUrl=	    newUrl.replaceAll(match, "");
			
				    System.out.println("===================replaced url:"+newUrl+"===================");
/*			String order_num="11111";
			Connection conn1=DBTrans.getConnection();
			//Connection conn1=DBTrans.getConnection("sms_in");
			Customer.getSubscriberAndSMSTemple(order_num, conn1);*/
			TestStatic t = new TestStatic();
			//TestQuery t = new TestQuery();
			Connection conn = DBTrans.getConnection();
			//t.vInBO.setString("order_num", "05552356300");
			//t.vInBO.setName("getSubscriberAndSMSTemple");//AF.

			String temp= "05662020861";       
			//Customer.getTriggerPhoneByOrderNum("05662020861",conn);
			ArrayList<String> SmsTempleId= new ArrayList<String>();
			SmsTempleId.add("10022");
			SmsTempleId.add("10024");
			SmsTempleId.add("10025");
			//Customer.getSmsTempleteBySmsTempleId(SmsTempleId,conn);
		        System.out.println(temp.substring(4));

		        //DBGadgets.check(conn);
			conn.rollback();
			//conn.commit();
			conn.close();
			//vLogger.info("返回数据是:\n\n\n\n" + BOHelper.boToXML(retBo));


		}
		catch(SQLException e)
		{
			e.printStackTrace();
		}
		catch(BaseException e)
		{
			e.printStackTrace();
			vLogger.error(e.ErrMethod);
			vLogger.error(e.SysMsg);
		}
			vLogger.info("---------------Game Over-------------");
	}	

		

	private int  init()
	{
		int iRet = 0;
		vSD = new  SessionData();
		vSD.vRoleCode = new String[] {"1"};
		vSD.vStaffCode = "1";
		vSD.vStaffNo = "0001";
		vSD.vStaffName = "test";
		
	
		vDebugHome = System.getProperty("DEBUG_HOME");
		if (vDebugHome == null)
		{
			iRet = -1;
			vLogger.error("需要设置DEBUG_HOME环境变量来指定debug 文件所在的目录");
		}
		return iRet;
		
	}
	
}
